package github.flandre.examplemod.core.init.event;

import github.flandre.examplemod.common.guiblock.GuiBlockInit;
import github.flandre.examplemod.core.init.BlockInit;
import github.flandre.examplemod.examplemod;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.FORGE)
public class BreakBlockEvent {
    @SubscribeEvent
    public static void onBlockBreak(BlockEvent.BreakEvent event)
    {
        //挖掘方块后掉落经验和额外物品
        if(event.getState().getBlock().equals(GuiBlockInit.EXAMPLE_BLOCK.get()))
        {
            event.setExpToDrop(50);
            event.getExpToDrop();
            event.getPlayer().addItemStackToInventory(new ItemStack(Items.DIAMOND));
        }
    }

}
